package Homework.Top2.StudentDao;


import java.util.List;
import java.util.Scanner;

public class StudentTest {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        StudentDao dao=new StudentDao();
        int choice;
        while (true){
            System.out.println("1:SearchPage，2：SearchOne,3:like,9：exit");
            choice=scanner.nextInt();
            switch (choice){
                case 1:
                    System.out.println("input page:");
                    int pageNo = scanner.nextInt();
                    System.out.println("input size:");
                    int pageSize = scanner.nextInt();
                    List<Student> all = dao.searchPage(pageNo,pageSize);
                    for(Student s:all)
                        System.out.println(s);
                    break;
                case 2:
                    System.out.println("input id:");
                    int id = scanner.nextInt();
                    Student student = dao.searchOne(id);
                    System.out.println(student==null?"not found":student);
                    break;
                case 3:
                    System.out.println("input name:");
                    String name = scanner.next();
                    System.out.println("input qq:");
                    String qq = scanner.nextLine();
                    System.out.println("input telephone:");
                    String telephone = scanner.next();
                    System.out.println("input pageNo:");
                    int pageNo1 = scanner.nextInt();
                    System.out.println("input pageSize:");
                    int pageSize1 = scanner.nextInt();

                    List<Student> a = dao.like(name,qq,telephone,pageNo1,pageSize1);
                    for(Student s:a)
                        System.out.println(s);
                    break;
                case 9:
                    System.exit(0);
                default:
                    System.out.println("default,input:");
                    break;
            }
        }
    }
}
